﻿@model SportsStore.Domain.Entities.ShippingDetails


@{
    ViewBag.Title = "SportStore:Checkout";
}

<h2>Checkout</h2>
<p>Please enter your details,and web'll shiip your goods right away!</p>
@using (Html.BeginForm())
{
    @Html.ValidationSummary()
    <h3>Ship to:</h3>
    <div class="form-group">
        <label>Name:</label>
        @Html.TextBoxFor(x => x.Name, new { @class = "form-control" })
    </div>
    <h3>Address</h3>
    /*
    <div class="form-group">
        <label>Line 1:</label>
        @Html.TextBoxFor(x => x.Line1, new { @class = "form-control" })
    </div>
    <div class="form-group">
        <label>Line 2:</label>
        @Html.TextBoxFor(x => x.Line2, new { @class = "form-control" })
    </div>
    <div class="form-group">
        <label>line 3:</label>
        @Html.TextBoxFor(x => x.Line3, new { @class = "form-control" })
    </div>
    <div class="form-group">
        <label>City:</label>
        @Html.TextBoxFor(x => x.City, new { @class = "form-control" })
    </div>
    <div class="form-group">
        <label>State:</label>
        @Html.TextBoxFor(x => x.State, new { @class = "form-control" })
    </div>
    <div class="form-group">
        <label>Zip:</label>
        @Html.TextBoxFor(x => x.Zip, new { @class = "form-control" })
    </div>
    <div class="form-group">
        <label>Country:</label>
        @Html.TextBoxFor(x => x.Country, new { @class = "form-control" })
    </div>
    用下面的方法简洁替换
    */
    foreach (var property in ViewData.ModelMetadata.Properties)
    {
        if (property.PropertyName!="Name" && property.PropertyName!="Giftwrap")
        {
            <div class="form-group">
                <label>@(property.DisplayName??property.PropertyName)</label>
                @Html.TextBox(property.PropertyName, null, new { @class="form-control"})
            </div>
        }
    }

    <h3>Options(选取)：</h3>
    <div class="checkbox">
        <label>
            @Html.EditorFor(x => x.GiftWrap)
            Gift Wrap these items(礼品包装)
        </label>
    </div>

    <div class="text-center">
        <input class="btn btn-primary" type="submit" value="Complete order(完成订单)" />
    </div>
}
